package com.bw.p19.login

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.alibaba.android.arouter.launcher.ARouter
import com.bw.base.mvvm.BaseActivity
import com.bw.p19.R
import com.bw.p19.databinding.ActivityUserBinding

class UserActivity : BaseActivity<ActivityUserBinding,LoginViewModel>() {
    override fun initView() {
        viewModel.userInfo()

        //点击跳转到修改密码页面
        binding.btnToUpdate.setOnClickListener {
            ARouter.getInstance().build("/app/UpdateActivity").navigation()
        }
    }

    override fun initData() {
        viewModel.userInfoSuccess.observe(this){
            if (it.code == 200){
                //用数据绑定的形式显示数据
                binding.info = it.data

            }
        }
    }

    override fun getVideModel(): Class<LoginViewModel> = LoginViewModel::class.java

    override fun getLayoutId(): Int  = R.layout.activity_user
}